package com.micro.app.controller;

import com.micro.app.client.FeignClientService;
import com.micro.common.constant.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author pan.shun
 * @since 2022/7/11 11:36
 */
@CrossOrigin
@RestController
@RequestMapping("/app")
public class AppController {

    @Autowired
    private FeignClientService feignClientService;

    @Value("${server.port:null}")
    private String port;

    @Value("${appId}")
    private String appId;

    @GetMapping("/query")
    public R query() {
        return R.success(port);
    }

    @GetMapping("/getDict")
    public R getDict(String code) {
        return feignClientService.getDictByCode(code, appId);
    }
}
